package com.crois.barrier.common.exception;

import lombok.Data;

/**
 * @author Hou Ze Yu
 * @description BarrierException
 * @date 2021/4/20
 */
public class BarrierException extends RuntimeException {

    private static final long serialVersionUID = 8068509879445395353L;

    public int getCode() {
        return code;
    }

    public BarrierException setCode(int code) {
        this.code = code;
        return this;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public BarrierException setMessage(String message) {
        this.message = message;
        return this;
    }

    private int code;

    private String message;

    public BarrierException(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public BarrierException(String message, int code) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public BarrierException(String message, Throwable cause, int code) {
        super(message, cause);
        this.code = code;
        this.message = message;
    }

    public BarrierException(Throwable cause, int code, String message) {
        super(cause);
        this.code = code;
        this.message = message;
    }

    public BarrierException(BarrierExceptionEnum doorExceptionEnum){
        super(doorExceptionEnum.getMessage());
        this.code= doorExceptionEnum.getCode();
        this.message = doorExceptionEnum.getMessage();
    }

    public BarrierException() {
        super();
    }

    public BarrierException(String message) {
        super(message);
    }

    public BarrierException(String message, Throwable cause) {
        super(message, cause);
    }

    public BarrierException(Throwable cause) {
        super(cause);
    }

    protected BarrierException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
}
